#include "pch.h"
#include "RendererFactory.h"
#include "GuiRenderer.h"
#include "ShadowRenderer.h"
#include "FrontRenderer.h"
#include "DeferredRenderer.h"
#include "PostRenderer.h"
#include "ParticleRenderer.h"
#include "SkinRenderer.h"
namespace mini
{
	CRendererFactory::CRendererFactory()
	{
	}


	CRendererFactory::~CRendererFactory()
	{
	}

	CRenderer* CRendererFactory::createRenderer(RendererType type)
	{
		CRenderer* pRenderer = nullptr;
		switch (type)
		{
		case RendererType::GuiRenderer:
			pRenderer = new ui::CGuiRenderer(GEngine->getDevice());
			pRenderer->setDeviceContext(GEngine->getDevice()->getDeviceContext(2), 2);
			break;
		case RendererType::ShadowRenderer:
			pRenderer = new CShadowRenderer(GEngine->getDevice());
			pRenderer->setDeviceContext(GEngine->getDevice()->getDeviceContext(1), 1);
			break;
		case RendererType::DeferredRenderer:
			pRenderer = new CDeferredRenderer(GEngine->getDevice());
			pRenderer->setDeviceContext(GEngine->getDevice()->getDeviceContext(0), 0);
			break;
		case RendererType::FrontRenderer:
			pRenderer = new CFrontRenderer(GEngine->getDevice());
			pRenderer->setDeviceContext(GEngine->getDevice()->getDeviceContext(0), 0);
			break;
		case RendererType::SkinRenderer:
			pRenderer = new CSkinRenderer(GEngine->getDevice());
			pRenderer->setDeviceContext(GEngine->getDevice()->getDeviceContext(0), 0);
			break;
		case RendererType::PostRenderer:
			pRenderer = new CPostRenderer(GEngine->getDevice());
			pRenderer->setDeviceContext(GEngine->getDevice()->getDeviceContext(4), 4);
			break;
		case RendererType::ParticleRenderer:
			pRenderer = new CParticleRenderer(GEngine->getDevice());
			pRenderer->setDeviceContext(GEngine->getDevice()->getDeviceContext(3), 3);
			break;

		}
		return pRenderer;
	}
}
